/**
 * Copyright ©2012-2018 HopeHaiyang Corporation, All Rights Reserved
 * http://www.wuhanhope.com
 */
package hope.platform.data.server.data.img;

import hope.platform.data.dao.DataManagementRepository;
import hope.platform.data.domain.DataManagement;
import hope.platform.data.server.data.header.DataManagementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * class info
 *
 * @author hujia
 *         Create at 2018/7/10 14:36
 */
@Service
public class DataManagementServiceImg implements DataManagementService {
    @Autowired
    private DataManagementRepository repository;

    @Override
    public DataManagement addDataManagement(DataManagement dataManagement) {
        dataManagement.setGmtCreate(new Date());
        dataManagement.setGmtModified(new Date());
        return repository.save(dataManagement);
    }

    @Override
    public DataManagement getDataManagementByDataName(String dataName) {
        return repository.findDataManageByDataName(dataName);
    }

    @Override
    public List<DataManagement> getDataManagementByDataKind(String dataKind) {
        return repository.findDataManageByDataKind(dataKind);
    }

    @Override
    public List<DataManagement> getAll() {
        return repository.findAll();
    }
}
